package com.hiwhitley.easy.day21;

/**
 * Created by hiwhitley on 2016/9/20.
 */
public class LengthOfLastWord_58 {
    public static int lengthOfLastWord(String s) {
        if (s == null)
            return 0;
        String[] words = s.split(" ");

        if (words.length == 0)
            return 0;
        else
            return words[words.length - 1].length();
    }

    public static void main(String[] args) {
        System.out.println(lengthOfLastWord("a"));
    }
}
